﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TanmiaGrp.Basis.Core;

namespace TanmiaGrp.GeneralLedger.IRepository.Basis
{
    public interface IGenericRepository
    {
        /// <summary>
        /// Persists entity in the repository and return the persisted object.
        /// </summary>
        /// <typeparam name="TBizEntity">The Business Entity type to be persisted.</typeparam>
        /// <param name="entity">business entity object to be persisted.</param>
        /// <returns>TBizEntity object if creation is done successfully. Null otherwise.</returns>
        TBizEntity Create<TBizEntity>(TBizEntity entity) where TBizEntity : class, new();

        /// <summary>
        /// Update the persisted business entity in the repository and return the persisted object.
        /// </summary>
        /// <typeparam name="TBizEntity">The Business Entity type to be persisted.</typeparam>
        /// <param name="entity">business entity object to be persisted.</param>
        /// <returns>TBizEntity object if creation is done successfully. Null otherwise.</returns>
        TBizEntity Update<TBizEntity>(TBizEntity entity) where TBizEntity : class, new();

        bool Delete<TBizEntity>(TBizEntity entity) where TBizEntity : class, new();
        bool Delete<TBizEntity>(IEnumerable<TBizEntity> entities) where TBizEntity : class, new();
    }

    public interface IGenericRepository<out T> : IGenericRepository
    {
    }

    public interface IDbRepository<T>
        where T : BusinessObject, new()
    {
        bool Create(T entity);
        bool Update(T entity);
        bool Delete(T entity);
        bool Delete(IEnumerable<T> entities);
    }

    public interface IDbRepository : IDbRepository<BusinessObject>
    {

    }
}